package com.baturu.vin.honda.dal.dao;

import com.baturu.vin.honda.dto.HondaImageDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * 本田图组信息DAO
 * @author jiangxinlei
 * @Time 2018/1/8.
 */
public interface HondaImageDAO {

    @Select({"<script>select distinct sortName, imageCode from honda_sort_image_mapping",
            "where npl = #{npl}",
            "and sortName in ",
            "<foreach item='item' index='index' collection='sortName' open='(' separator=',' close=')' >",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<HondaImageDTO> queryImageCodeBySortName(@Param("npl") String npl, @Param("sortName") Collection<String> sortName);

    @Select({"<script>select distinct nplblkedit as imageCode, nplblk as imageName from honda_pblokt",
            "where npl = #{npl}",
            "and nplblkedit in ",
            "<foreach item='item' index='index' collection='imageCode' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<HondaImageDTO> queryImageNameByNpl(@Param("npl") String npl, @Param("imageCode") Collection<String> imageCode);

    @Select({"select distinct nplblkedit as imageCode, nplblk as imageName from honda_pblokt",
            "where nplblkedit is not null"})
    List<HondaImageDTO> queryImageNameCode();
}
